package cate.common.table.item;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;

public class HeroPartRow extends ERow implements IBagItemTpl {

    /** 名称 */
    public String name;

    /**类型 */
    public byte type;

    public int pileMax;
    /** 阵营 */
    public byte camp;
    /** 星级 */
    public byte star;
    /** 消耗数量 */
    public int cost;
    /** 合成规则 */
    public int rule;
    /** 伙伴ID */
    public int heroTid;
    /** 献祭奖励的配置 */
    public String rewardConfig;
    /** 名称备注 */
    public String nameNote;

    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
        this.id = xrw.getInteger("id", 0);
        this.name = xrw.getString("名称");
        this.type = xrw.getByte("类型", (byte) 0);
        this.camp = xrw.getByte("阵营", (byte) 0);
        this.star = xrw.getByte("星级", (byte) 0);
        this.cost = xrw.getInteger("消耗数量", 1);
        this.rule = xrw.getInteger("合成规则", 0);
        this.heroTid = xrw.getInteger("伙伴id", 0);
        this.rewardConfig = xrw.getString("献祭奖励");
        this.pileMax = xrw.getInteger("最大叠加数量",1);
        this.nameNote = xrw.getString("名称备注");
    }

    @Override
    public boolean available() {
        return this.id > 0;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String toName() {
        return this.nameNote;
    }

    @Override
    public boolean unique() {
        return false;
    }

    @Override
    public int getTemplateId() {
        return this.id;
    }

    @Override
    public long getPileMax() {
        return pileMax;
    }
}
